package com.xju.boot_17_18.controller;

import com.xju.boot_17_18.entity.Employee;
import com.xju.boot_17_18.service.EmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class UserController {
    @Autowired
    private EmployeeService employeeService;

    @RequestMapping("/index")
    public String index(Model model) {
        model.addAttribute("price", 99.9);
        model.addAttribute("str", "字符串");
        Employee employee = employeeService.getById(2);
        model.addAttribute("employee", employee);
        model.addAttribute("color", "red");
        List<Employee> list = employeeService.list(null);
        model.addAttribute("list", list);
        // 我是组员
        // 组长写代码
        System.out.println("组员写的");
        return "html";
    }
}
